The present invention relates to hardware accelerators and, more specifically, to mixing restartable and non-restartable requests with performance enhancements.
Hardware acceleration is the performance of certain functions in hardware, such that those functions may potentially be performed more efficiently than they might be if performed in software, or so as to enable the software to focus on other functionality. The hardware used in hardware acceleration may be integrated with a central processing unit (CPU) of a host machine, or that hardware may be a separate device known as a hardware accelerator.
Generally, a hardware accelerator is connected to the CPU, such as through an input/output adapter. Software on the host machine uses a hardware accelerator through one or more libraries, each of which utilize a common interface, through which the software can communicate with a device driver of the hardware accelerator. In other words, the library communicates with the device driver, which communicates with the hardware accelerator. Requests can be executed on the hardware accelerator through the interface. In some cases, however, a request will need to be restarted, potentially on a different hardware accelerator. This may be the case, for example, if the hardware accelerator initially executing the request fails during the execution.
To enable restarts of requests, the interface provides for an input buffer and an output buffer, also referred to respectively as an input state area and an output state area, which are managed by the device driver. Generally, the input buffer and the output buffer are used to maintain input states and output states of the hardware accelerator. To enable restartable requests, the input state existing at the beginning of execution of the request needs to be maintained in the input buffer while a request is being executed by the hardware accelerator. To this end, for instance, the device driver copies the input state from the input buffer to a secondary buffer, and the device driver processes the request using the secondary buffer. The result of the request is written to the output buffer. This maintains the input state in pristine condition in the input buffer. Thus, if the accelerator fails while processing the request, the request can be restarted with its original input state.
Because the output buffer contains the current state of the hardware accelerator after execution of a request, the library will instruct the device driver to swap the input buffer and the output buffer at the conclusion of the request. For instance, a pointer indicating the input buffer can be updated to reference the output buffer, and a pointer indicating the output buffer can be updated to reference the input buffer. As a result, the output buffer becomes the input buffer for the next request received. The acts of writing to the current state to the output buffer and then swapping the input and output buffers occurs at the conclusion of each successful request.